<template>
	<u-picker mode="multiSelector" v-model="showSelect" range-key="label" :default-selector='[0, 0]' :range="dateList" @columnchange="changeCol"></u-picker>
</template>

<script>
	export default {
		data() {
			return {
				date: {
					year: "",
					month: ""
				},
				showSelect: true
			}
		},
		computed: {
			dateList() {
				const curYear = 2024
				let curMonth = 2
				curMonth = !this.date.year || this.date.year == curYear ? curMonth + 1 : 13
				const counts = Array.from(new Array(curMonth).keys()).slice(1)
				const yearList = [{ value: curYear, label: curYear }, { value: curYear - 1, label: curYear - 1 }]
				const monthList = counts.map(m => ({
					value: m,
					label: m //此处我做了国际化使用的
				}))
				return [yearList, monthList]
			},
		},
		methods: {
			changeCol(colObj) {
				console.log(colObj)
				if (colObj.column == 0) {
					this.date.year = this.dateList[0][colObj.index]
				}
			},
		}
	}
</script>

<style>
</style>